<script type="text/javascript">
function  deleteZimmer(id , name){
	if (confirm("<?PHP LangText('DeleteMas'); ?>")) {//if yes
	   window.location =document.URL+'&FileID='+id;
	}
}
function validateOnSubmit(formElem) {
		formElem.submit();
	};
</script>
<?php
if (!empty ($_SESSION["CMS_User"]["ID"])) {
	if (!empty ($_GET['FileID'])) {
		$sql = "select * From files WHERE UserID={$_SESSION["CMS_User"]["ID"]} and ID = {$_GET['FileID']} ";
		$_rd = mysql_query($sql, $_db_link);
		if ($_rd)
			if ($daten = mysql_fetch_array($_rd, MYSQL_ASSOC)) {
				$sql = 'DELETE  FROM files WHERE ID=' . $_GET['FileID'];
				mysql_query($sql, $_db_link);
				unlink('Admin/UploadFiles/' . $daten['Adresse']);
				unlink('Admin/UploadFiles/medium/' . $daten['Adresse']);
				unlink('Admin/UploadFiles/small/' . $daten['Adresse']);
			}

	} 
	if($_FILES){
		echo "up";
		uploadFile();
	}
	$sql = "select * From files WHERE UserID={$_SESSION["CMS_User"]["ID"]}";
	$_rd = mysql_query($sql, $_db_link);
	$str = "";
	if ($_rd) {
		$sw = "row1";
		$str = "<div class='FirmaView'><table class='FirmaList'>
				<tr class='$sw'>
				<td><b>" . LangTextOut("ID") . "</b></td>
				<td><b>" . LangTextOut("Titel") . "</b></td>
				<td><b>" . LangTextOut("Adresse") . "</b></td>" .
		"</tr>";
		while ($daten = mysql_fetch_array($_rd, MYSQL_ASSOC)) {
			if ($sw == "row1") {
				$sw = "row2";
			} else {
				$sw = "row1";
			}
			$str = $str . "<tr class='$sw'>
							<td>" . $daten["ID"] . "</td>
							<td>" . $daten["Titel"] . "</td>
							<td>" . $daten["Adresse"] . "</td>" .
			"<td><a  href=\"javascript:deleteZimmer('" . $daten["ID"] . "','" . $daten["Titel"] . "');\"  >" . LangTextOut("Delete") . "</a>" .
			"</td>" .
			"</tr>";
		}
		$str = $str . "</table></div>";
	}
	echo $str;
}
?>
<hr>
<input type='file' id='file' name='file' />
<input type="button"  onclick="validateOnSubmit(this.form);" class="BootenLink" value='<?PHP LangText("Upload-Datei");?>' />

